// pages/datijieguo/datijieguo.js
const app = getApp()
Page({
  /**
   * 页面的初始数据
   */
  data: {
    passingGrade: 0,
    grade: '',
    testTime: '',
    isPass: '',
    title: '',
    resultId: '',
    examId: '',
    resMap: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    var userId = app.getLoginInfo().id;
    console.log(examId);
    var examId = options.examId;
    var userId = app.getLoginInfo().id;
    wx.request({
      header: app.header(),
      url: app.globalData.url + '/myCenter/exam/detail/' + examId+'/' + userId,
      data: '',
      success: function (res) {
        console.log(res.data.result);
        if (res.data.status == "success") {
          that.setData({
            grade: res.data.result.grade,
            testTime: res.data.result.testTime,
            isPass: res.data.result.isPass,
            resMap: res.data.result.resMap,
            title: res.data.result.title,
            resultId: res.data.result.resultId,
            examId: res.data.result.examId,
            passingGrade: res.data.result.passingGrade
          })
        }
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },
  //查看答案
  checkAnswer: function (e) {
    var rid = e.currentTarget.dataset.rid;
    var eid = e.currentTarget.dataset.eid;
    console.log(rid);
    console.log(eid);
    wx.navigateTo({
      url: '../kaoshidaan/kaoshidaan?examId=' + eid + '&resultId=' + rid
    })
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})